package com.study.springcache.common.config;

import org.springframework.cache.interceptor.KeyGenerator;
import org.springframework.stereotype.Component;

import java.lang.reflect.Method;

/**
 * @Description:
 * @Author: 刘超
 * @Date: 2023-06-13 9:51
 */
@Component
public class CacheDemoKeyGenerator implements KeyGenerator {
    @Override
    public Object generate(Object target, Method method, Object... params) {
        String key = (String) params[0];
        String version = (String) params[1];
        String keyResult = new StringBuilder(key).append(":").append(version).toString();
        return keyResult;
    }
}
